package com.atguigu.gmall.product.service.impl;

import com.atguigu.gmall.product.model.SpuSaleAttr;
import com.atguigu.gmall.product.model.SpuSaleAttrValue;
import com.atguigu.gmall.product.mapper.SpuSaleAttrValueMapper;
import com.atguigu.gmall.product.service.SpuSaleAttrValueService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * spu销售属性值 业务实现类
 *
 * @author muzhuo
 * @since 2023-07-25
 */
@Service
public class SpuSaleAttrValueServiceImpl extends ServiceImpl<SpuSaleAttrValueMapper, SpuSaleAttrValue> implements SpuSaleAttrValueService {

    @Autowired
    private SpuSaleAttrValueService spuSaleAttrValueService;

    @Override
    public List<SpuSaleAttrValue> getListByspuId(Long id, Long baseSaleAttrId) {
        LambdaQueryWrapper<SpuSaleAttrValue> queryWrapper = new LambdaQueryWrapper<SpuSaleAttrValue>();
        queryWrapper.eq(SpuSaleAttrValue::getSpuId, id);
        queryWrapper.eq(SpuSaleAttrValue::getBaseSaleAttrId, baseSaleAttrId);
        return this.list(queryWrapper);


    }

    @Override
    public void removeBySpuId(Long spuId) {
        baseMapper.deleteBySpuId(spuId);
    }
}
